<template>
  <!-- 随访体检审核信息查询 -->
  <typeBase>
    <template v-slot:main-left>
      <Institution />
    </template>
    <template v-slot:main-button>
      <mainButton
        @toMainSearch="search"
        @toMainSearchReset="reset"
        :main-button="mainButton"
      />
    </template>
    <template v-slot:search-info>
      <searchMain
        size="mini"
        :label-width="labelWidth"
        ref="searchMain"
        :model="formData"
        :rules="searchRules"
        :itemList="formItemList"
      />
      <el-divider />
    </template>
    <template v-slot:table-main>
      <common-table
        :data="infoList"
        border
        :columns-item="columns"
        :title="infoTitle"
        :loading="false"
        @checkbox-change="selectChangeEvent"
      />
    </template>
  </typeBase>
</template>
<script>
import typeBase from "@/components/Layout/typeBase.vue"
import Institution from "@/components/Trees/Institution.vue"
import mainButton from "@/components/CommonButtons/MainButton.vue"
import searchMain from "@/components/CommonForm/index.vue"
import CommonTable from "@/components/CommonTable/index.vue"
// 加载模拟数据
import {
  // infoList,
  testList,
  sexs,
  fileStatusType,
  liveType,
  dataSource,
  helpPoor,
  peopleSigns,
  publicSigns,
  addressList,
  information,
  auditStatus,
  businessType,
  dataProps,
  searchHandle
} from "@/simdata/healthData.js"
import { dataList } from '@/simdata/record/examination.js'
export default {
  components: {
    typeBase,
    Institution,
    mainButton,
    searchMain,
    CommonTable
  },
  data() {
    return {
      // 配置常用按钮
      mainButton: [
        {
          label: "查看审核意见",
          icon: "el-icon-document",
          type: "primary",
          handle: () => this.addHandle()
        }
      ],
      // 查询表单
      formData: {
        keyword: "", // 个人信息项 字段
        keyValue: "", // 值
        createDate: null, // 建档日期 开始
        endDate: null // 结束日期
      },
      // label的宽度
      labelWidth: "auto",
      // 验证
      searchRules: {
        // Address_value: [
        //   { required: true, message: "请选择常用地址", trigger: "change" }
        // ]
      },
      // 配置search label表单
      formItemList: [
        {
          type: "Input",
          label: "姓名",
          prop: "name",
          span: 8,
          placeholder: ""
        },
        {
          type: "Input",
          label: "身份证号",
          prop: "identityNumber",
          span: 8,
          placeholder: ""
        },
        {
          type: "Select",
          label: "业务类型",
          prop: "businessType",
          span: 8,
          options: businessType,
          props: dataProps,
          change: row => "",
          placeholder: "请选择..."
        },
        {
          type: "Select",
          label: "审核状态",
          prop: "auditStatus",
          span: 8,
          options: auditStatus,
          props: dataProps,
          change: row => "",
          placeholder: "请选择..."
        },
        {
          type: "data",
          label: "建档日期",
          prop: "createDate",
          span: 8,
          placeholder: "请选择..."
        },
        {
          type: "data",
          label: "至",
          prop: "endDate",
          span: 8,
          placeholder: "请选择..."
        }
      ],
      // 所有列表数据
      infoTitle: "【数据审核列表】",
      infoList: dataList,
      // 配置显示的label标签
      columns: [
        { prop: "name", label: "姓名", width: "90" },
        {
          prop: "sex",
          label: "性别",
          width: "90",
          type: "sex",
          option: sexs
        },
        { prop: "age", label: "年龄", width: "80" },
        { prop: "birthdata", label: "出生日期", width: "100" },
        { prop: "identityNumber", label: "身份证号", width: "180" },
    
        { prop: "physicalTime", label: "随访/体检时间", width:"100" },
        { prop: "responsibleDoctor", label: "随访医生", width: "100" },
        { prop: "organ", label:"建档机构", width:"200" },

        {
          prop: "businessType",
          label: "业务类型",
          width: "150",
          type: "businessType",
          option:businessType
        },


        { prop: "auditStatus", label: "审核状态", width: "100", option:auditStatus },
        { prop: "examineName", label: "审核人姓名", width: "100" },
        { prop: "createDate", label: "审核时间", width: "180" }
      ]
    }
  },
  created(){
    console.log(dataList)
  },
  methods: {
    // 点击新增按钮
    addHandle() {
      console.log("点击新增了")
    },
    // 切换常用地址
    handleChange() {
      console.log("点击了")
    },
    // 点击搜索按钮
    search(formName) {
      this.$refs.searchMain.$refs[formName].validate(valid => {
        if (valid) {
          console.log(this.formData)

          // 调用接口
          this.callbackComponent()
        } else {
          console.log("error submit!!")
          return false
        }
      })
    },
    // 点击重置按钮
    reset(formName) {
      this.$refs.searchMain.$refs[formName].resetFields()
      // console.log(this.formData)
    },
    // 点击搜索后，请求后台接口了
    callbackComponent() {
      console.log("调接口")
    },
    // 家庭基本信息复选框选中
    selectChangeEvent({ checked, records }) {
      console.log(checked)
      console.log(records)
    }
  }
}
</script>
<style lang="scss" scoped>
/deep/ .common-table {
  margin-right: 0;
}
/deep/ .table-item {
  margin-right: 0 !important;
}
</style>
